/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 *
 */
import * as path from 'path';

import { BaseModifier } from './base-modifier';

/**
 * 修改指定模块的form_config.json
 */
export class FormConfigModifier extends BaseModifier {

  constructor(cwd: string, moduleName: string, target = 'main') {
    super(path.resolve(cwd, moduleName, 'src', target, 'resources/base/profile/form_config.json'));
  }

  public setUiSyntax(uiSyntax: string) {
    // @ts-ignore
    this.jsonObject.forms[0].uiSyntax = uiSyntax;
    return this;
  }

  public setSrc(src: string) {
    // @ts-ignore
    this.jsonObject.forms[0].src = src;
    return this;
  }

}
